package movie.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import movie.entity.Cinema;
import movie.service.CinemaScheduleFindAllService;

@Controller
public class CinemaScheduleFindAllController {

	@Autowired
	private CinemaScheduleFindAllService cinemaScheduleFindAllService;
	
	@RequestMapping(value = "/cinemaschedulefindall", method = RequestMethod.GET)
	public String get(Model model,HttpServletRequest request) 
	{
		HttpSession session = request.getSession();

		if(session.getAttribute("cinemaId") == null) {
			return "forward:clogin.jsp";
		} 
		List<Cinema> cinemas=cinemaScheduleFindAllService.findAll();
		model.addAttribute("cinemas", cinemas);
		return "Cinema/cinemalist";
	}
	
	
}
